package com.prik.decorator.condiment;

import com.prik.decorator.coffee.Beverage;

/**
 * @description: 香草，装饰者，继承配料超类
 * @author: prik
 * @create: 2019-07-24
 **/
public class Vanilla extends CondimentDecorator {

    Beverage beverage; // 用来记录被装饰者

    public Vanilla(Beverage beverage) { // 构造函数，被装饰者作为参数
        this.beverage = beverage;
    }

    @Override
    public String getDescription() { // 获取完整的描述
        return beverage.getDescription() + ", 香草";
    }

    @Override
    public double cost() { // 用被装饰者的价格加上香草自己的价格
        return 3 + beverage.cost();
    }
}